package rsp

import (
	"github.com/gin-gonic/gin"
	"net/http"
)

// SuccessDiypResultRsp 是用于封装 API 成功响应的结构体
type SuccessDiypResultRsp struct {
	BaseResultRsp
	ChannelName string      `json:"channel_name"`
	Date        string      `json:"date"`
	Url         string      `json:"url"`
	Icon        string      `json:"icon"`
	EpgData     interface{} `json:"epg_data"` // 修改了 JSON 标签
}

// 正确状态处理
func SuccessDiyp(c *gin.Context, msg string, data interface{}, channelName string, icon string, date string) {
	response := SuccessDiypResultRsp{
		BaseResultRsp: BaseResultRsp{
			Code:    200,
			Message: msg,
		},
		EpgData:     data, // 修改了字段名
		ChannelName: channelName,
		Url:         "http://127.0.0.1:8082/epg/diyp",
		Icon:        icon,
		Date:        date,
	}
	c.JSON(http.StatusOK, response)
}

// 正确状态处理
func SuccessEpginfo(c *gin.Context, msg string, data interface{}, channelName string, icon string, date string) {
	response := SuccessDiypResultRsp{
		BaseResultRsp: BaseResultRsp{
			Code:    200,
			Message: msg,
		},
		EpgData:     data, // 修改了字段名
		ChannelName: channelName,
		Url:         "http://127.0.0.1:8082/epg/epginfo",
		Icon:        icon,
		Date:        date,
	}
	c.JSON(http.StatusOK, response)
}
